﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLPM.DTO;
using System.Data;

namespace QLPM.DAO
{
    public class ThamSoDAO
    {
        DataProvider provider;

        public ThamSoDAO()
        {
            provider = new DataProvider();
        }

        public int LaySoBNToiDa()
        {
            String sql = "select SoBenhNhanToiDa from THAMSO";
            provider = new DataProvider("THAMSO",sql);
            DataTable dt = provider;
            int temp = Convert.ToInt32(dt.Rows[0]["SoBenhNhanToiDa"].ToString());
            return temp;
        }
        public int LaySoLuongLoaiBenh()
        {
            string sql = "select SoLuongLoaiBenh From THAMSO";
            provider = new DataProvider("THAMSO", sql);
            DataTable dt = provider;
            int temp = Convert.ToInt32(dt.Rows[0]["SoLuongLoaiBenh"].ToString());
            return temp;
        }
        public int LaySoLuongLoaiThuoc()
        {
            string sql = "select SoLuongLoaiThuoc From THAMSO";
            provider = new DataProvider("THAMSO", sql);
            DataTable dt = provider;
            int temp = Convert.ToInt32(dt.Rows[0]["SoLuongLoaiThuoc"].ToString());
            return temp;
        }
        public int LaySoluongCachDung()
        {
            string sql = "select SoLuongCachDung From THAMSO";
            provider = new DataProvider("THAMSO", sql);
            DataTable dt = provider;
            int temp = Convert.ToInt32(dt.Rows[0]["SoLuongCachDung"].ToString());
            return temp;
        }
        public int LayTienKham()
        {
            string sql = "select TienKham From THAMSO";
            provider = new DataProvider("THAMSO", sql);
            DataTable dt = provider;
            int temp = Convert.ToInt32(dt.Rows[0]["TienKham"].ToString());
            return temp;
        }
        public int LaySoluongDonVi()
        {
            string sql = "select SoLuongDonVi From THAMSO";
            provider = new DataProvider("THAMSO", sql);
            DataTable dt = provider;
            int temp = Convert.ToInt32(dt.Rows[0]["SoLuongDonVi"].ToString());
            return temp;
        }
        public int SuaSoBenhNhanToiDa(int so)
        {
            string sql = "update THAMSO set SoBenhNhanToiDa = {0} , so";
            return provider.Excute_Non_Query(sql);
        }
        public int SuaSoLuongLoaiBenh(int so)
        {
            string sql = "update THAMSO set SoLuongLoaiBenh = {0} , so";
            return provider.Excute_Non_Query(sql);
        }
        public int SuaSoLuongLoaiThuoc(int so)
        {
            string sql = "update THAMSO set SoLuongLoaiThuoc = {0} , so";
            return provider.Excute_Non_Query(sql);
        }
        public int SuaSoLuongCachDung(int so)
        {
            string sql = "update THAMSO set SoLuongCachDung = {0} , so";
            return provider.Excute_Non_Query(sql);
        }
        public int SuaSoLuongDonVi(int so)
        {
            string sql = "update THAMSO set SoLuongDonVi = {0} , so";
            return provider.Excute_Non_Query(sql);
        }
        public int SuaTienKham(int so)
        {
            string sql = "update THAMSO set TienKham = {0} , so";
            return provider.Excute_Non_Query(sql);
        }

    }
}
